package com.example.rectanimationtest;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.Window;

import com.example.rectanimationtest.AnimaUtils.MainUpLayout;
import com.example.rectanimationtest.AnimaUtils.MainUpView;

public class MainActivity extends Activity {
	private static final String TAG = "zsr";
	private MainUpView mainUpView;
	private float SACLE = 1.2f;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.activity_main);
		mainUpView = (MainUpView) findViewById(R.id.mainview);
		mainUpView.setUpRectResource(R.drawable.test_rectangle); //设置边框
		mainUpView.setUpRectShadeResource(R.drawable.item_shadow);//设置阴影
		MainUpLayout mainUpLayout = (MainUpLayout) findViewById(R.id.mainuplayout);
		mainUpLayout.getViewTreeObserver().addOnGlobalFocusChangeListener(new ViewTreeObserver.OnGlobalFocusChangeListener() {
			@Override
			public void onGlobalFocusChanged(View oldView, View currentView) {
				mainUpView.setFocusView(currentView,oldView,SACLE);
				oldView = currentView;  //4.3以下需手动保存

			}
		});
	}
}
